[THE GRAPH] fix: unlockTime should return THAWING_PERIOD times two #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unlocks::getMetadata
is a view only function intended to mainly be used by theRenderer
contract to render the returned metadata as an SVG for display on NFT marketplaces like OpenSea.The problem exists in
Metadata::progress
, in case of The Graph (and only The Graph) his function would currently revert if the unlock time for a specificunlockID
is GREATER THANTHAWING_PERIOD
Remember for The Graph, we have to batch up user unlocks and process them on a rolling window of each
THAWING_PERIOD
This means that worst case scenario, the unlock time for a user can be
THAWING_PERIOD * 2
.However
GraphAdater::unlockTIme
returnsTHAWING_PERIOD
Meaning that the following line in our
Unlocks::getMetadata
can revert ifmaturity - currentTime > THAWING_PERIOD
because the result ofmulDivUp
will be greater than 100.While it is impossible to get an accurate progress on-chain for The Graph unlocks at this point, we can prevent the function from unexpectedly reverting by treating the unlockTime as
2*THAWING_PERIOD
.